<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../assets/css/base.css">
    <style>
        body{
            margin: 0px;
        }
        .swiper-container{
            width: 100%;
            height: 200px;
            border: 1px solid black;
            box-sizing: border-box;
        }
        .swiper-slide{
            width: 100%;
            height: 100%;
        }
        .swiper-slide:nth-child(1){
            background-color: #4390ee;
        }
        .swiper-slide:nth-child(2){
            background-color: #ca4040;
        }
        .swiper-slide:nth-child(3){
            background-color: #ff8604;
        }
    </style>
</head>

<body>
    <div id="app">
        <div class="swiper" ref="loopA">
            <div class="swiper-wrapper">
                <div v-for="item in size" class="swiper-slide">{{ "slide"+item }}</div>
            </div>
        </div>
        <input type="button" value="initLoop" @click="initLoop()">
    </div>

    <link rel="stylesheet" href="../assets/swiper8/swiper.min.css">

    <script src="../assets//mockjs/mock-min.js"></script>
    <script type="module">
        import { createApp, nextTick } from "../assets/vue3/vue.esm-browser.js";
        import Swiper from "../assets/swiper8/swiper-bundle.esm.browser.js";
        createApp({
            data () {
                return {
                    size:[]
                }
            },
            methods: {
                async initLoop(){
                    this.size = [1,2,3]
                    // Swiper 需要依赖页面中DOM的数量来初始化轮播效果
                    // Swiper 4.0 以后的版本，Swiper增加DOM变化的监控功能，DOM更新后会自动重载Swiper
                    new Swiper(this.$refs.loopA,{})
                }
            },
        }).mount("#app")
    </script>
</body>

</html>